package com.lixianbiao.validation.processor;

import com.lixianbiao.validation.annotation.NotNull;

import java.lang.annotation.Annotation;

/**
 * @author lixianbiao
 * @since 2024/06/22 09:32
 */
public class NotNullProcessor implements Processor{
    @Override
    public boolean process(Annotation annotation, Object object) {
        if(annotation instanceof NotNull notNull){
            if(notNull.value()){
                return object != null;
            }else {
                return object == null;
            }
        }else {
            throw new IllegalArgumentException();
        }
    }
}